<?php
	
	include_once("Login.php");

	$conn = new mysqli($host,$user,$passwd, $database)
	or die("SQL connect error: ".mysqli_connect_error());

	$body = file_get_contents('php://input');
	$xml = simplexml_load_string($body);
	$cloudId = $xml->cloudId;	

	$query = "SELECT Id, Place, Lon, Lat FROM Places WHERE CloudId='$id' AND IsCurrentLocation='0'";
	//"SELECT * FROM Message JOIN User t JOIN User f ON Message.ToUserId = User.Id WHERE Message.ToUserId='$userId' OR Message.FromUserId='$userId'";

	$result = mysqli_query($conn, $query);
	echo "<node>";
	while($row = mysqli_fetch_array($result))
	
	{
		
		
	echo "<place>";
			echo "<id>";
			
				echo $row['Id'] . "\n";		
			echo "</id>";
		
			echo "<place>";		
				echo $row['Place'] . "\n";			
			echo "</place>";			
			echo "<lon>";			
				echo $row['Lon'] . "\n";			
			echo "</lon>";			
			echo "<lat>";			
				echo $row['Lat'] . "\n";

			echo "</lat>";		
			echo "</place>";
			
			
	}
	
	echo "</node>";	
		mysqli_close($conn);

?>


